/**
 * 
 */
package com.aspire.android.heliar.pub;

import java.util.Date;

/**
 * @author panglei
 * 
 */
public class Pub {
	private long id;
	private String title;
	private Date date;
	private String author;
	private String desc;
	private String rawId;
	private String key;
	private String type;
	private long coverId;
	private String coverFilepath;
	private String rawFullContent;
	private ContentNode rootNode = new ContentNode();
	private ImageAttachment cover;

	public String getDesc() {
		return desc;
	}

//	public ImageAttachment getCoverAttachment() {
//		if (rootNode != null) {
//			if (rootNode.getChildNodes().size() > 0) {
//				ContentNode firstNode = rootNode.getChildNodes().get(0);
//				Set<String> names = firstNode.getAttachments().keySet();
//				if (names.size() > 0) {
//					for (String name : names) {
//						ImageAttachment image = (ImageAttachment) firstNode
//								.getAttachments().get(name);
//						if (image != null) {
//							return image;
//						}
//					}
//				}
//			}
//		}
//
//		return null;
//	}

	public void addAttachment(PubAttachment pubAttachment) {
		rootNode.addAttachment(pubAttachment);
	}

	public void addChildNode(ContentNode node) {
		rootNode.addChildNode(node);
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public String getRawFullContent() {
		return rawFullContent;
	}

	public void setRawFullContent(String rawFullContent) {
		this.rawFullContent = rawFullContent;
	}

	public ContentNode getRootNode() {
		return rootNode;
	}

	public void setRootNode(ContentNode rootNode) {
		this.rootNode = rootNode;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public String getRawId() {
		return rawId;
	}

	public void setRawId(String rawId) {
		this.rawId = rawId;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public long getCoverId() {
		return coverId;
	}

	public void setCoverId(long coverId) {
		this.coverId = coverId;
	}

	public String getCoverFilepath() {
		return coverFilepath;
	}

	public void setCoverFilepath(String coverFilepath) {
		this.coverFilepath = coverFilepath;
	}

	public ImageAttachment getCover() {
		return cover;
	}

	public void setCover(ImageAttachment cover) {
		this.cover = cover;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

}
